Skip to content

Feat/phase3 rag pipeline - #16

Merged
Teng91 merged 10 commits into
masterfrom
feat/phase3-rag-pipeline
Jun 12, 2026
Merged

Feat/phase3 rag pipeline#16
Teng91 merged 10 commits into
masterfrom
feat/phase3-rag-pipeline

Conversation

@Teng91

@Teng91 Teng91 commented Jun 9, 2026

Copy link
Copy Markdown
Owner

No description provided.

Joy Teng added 2 commits June 5, 2026 17:46
New endpoints:
- POST /tools/search — hybrid dense + sparse retrieval with RRF fusion
- POST /tools/chat — RAG chat powered by Claude API

Infrastructure:
- BGE-M3 embedding model (lazy singleton, CPU)
- Sparse vector storage via pgvector sparsevec(250002)
- New config: CHATBOT_SPARSE_DIMENSION, RRF_K, SEARCH_CANDIDATES,
  MAX_CONTEXT_CHUNKS, LLM_API_KEY, LLM_MODEL

Tests: 53 passing (contract, router, service)

Closes #16
- Anthropic Claude -> Gemini -> raw context fallback when no keys
- Add CHATBOT_GEMINI_API_KEY / CHATBOT_GEMINI_MODEL settings
- Update rag-pipeline.md spec with fallback behavior and config vars
- Remove dead code in _call_gemini (unreachable guard)
- Clean leaked API key placeholder in integration.md
- Add test coverage for no-LLM-key fallback path
@Teng91 Teng91 self-assigned this Jun 9, 2026
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Coverage

Test Coverage
FileStmtsMissCoverMissing
src/chatbot_plugin
   __init__.py00100% 
   main.py241345%20, 28–29, 31–36, 38–39, 47, 49
   routers.py18194%22
src/chatbot_plugin/contracts
   __init__.py20100% 
   chat_completion.py330100% 
TOTAL771481% 

Tests Skipped Failures Errors Time
5 0 💤 0 ❌ 0 🔥 0.112s ⏱️

Joy Teng and others added 8 commits June 9, 2026 17:19
- test_llm_caller.py: Gemini success/api-error/malformed, Anthropic success,
  Anthropic fallback to Gemini (5 tests)
- test_models.py: Article and ArticleChunk __repr__ (2 tests)
- Coverage: 81% -> 90%, service.py: 78% -> 98%
…nAI-compatible /v1/chat/completions

Breaking changes:
- Remove all /tools/* endpoints (chunks, search, chat)
- Add single OpenAI-compatible POST /v1/chat/completions endpoint
- Extract all SDK logic into separate chatbot-plugin-sdk package
- Remove redundant local code: config, db, embedding, models, service, contracts/requests, contracts/responses
- Import DB, models, contracts, exceptions, RagQueryProcessor from chatbot_plugin_sdk
- Update main.py lifespan to initialize RagQueryProcessor from SDK
- Update tests to mock RagQueryProcessor and test /v1/chat/completions
- Update spec: add SDK Usage chapter, update class hierarchy to BaseRagProcessor / RagArticleProcessor / RagQueryProcessor
- Update pyproject.toml: remove LLM/db dependencies (moved to SDK)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add chatbot-plugin-sdk to main dependencies
- Add httpx to dev dependencies for ASGITransport/AsyncClient in tests
- Bump version to 0.3.0
- Add pytest.xml and coverage.xml to .gitignore

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Teng91
Teng91 merged commit f84f940 into master Jun 12, 2026
2 checks passed
@Teng91
Teng91 deleted the feat/phase3-rag-pipeline branch June 12, 2026 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant